package com.example.dblianxiwj.galleryhelp;
import com.example.dblianxiwj.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
   
	private Context context;
	
	public static Integer[] images = { R.drawable.ga,R.drawable.gb,R.drawable.gd,
		R.drawable.ge,R.drawable.gf,R.drawable.gg};
  
	int mGalleryItemBackground;
	public ImageAdapter(Context context) {
		this.context=context;
	}

	@Override
	public int getCount() {
		return images.length;
	}

	@Override
	public Object getItem(int position) {
		return images[position];
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView=new ImageView(context);
		imageView.setImageResource(images[position]);
		imageView.setBackgroundResource(mGalleryItemBackground);
		imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
		imageView.setAdjustViewBounds(true);
		return imageView;
	}

}
